<template>
  <el-card class="userInfoCard">
    <el-row>
      <el-col :span="12" :offset="5">
        <img class="userHeader" :src="cardForm.avatar" />
      </el-col>
    </el-row>
    <el-row class="userName">{{ cardForm.nickName }}</el-row>
    <el-row style="margin-top: 10%;">
      <el-col :span="10">发表文章</el-col>
      <el-col :span="10" :offset="4">总阅读量</el-col>
    </el-row>

    <el-row style="margin-top: 5%;">
      <el-col :span="10" style="text-align: center;">{{ cardForm.articleNum }}</el-col>
      <el-col :span="10" style="text-align: center;" :offset="4">{{ cardForm.viewCount }}</el-col>
    </el-row>

  </el-card>
</template>

<script>
import { mineInfo } from '@/api/user'
export default {
  name: "UserCard",
  created() {
    this.getUserCard()
  },
  data() {
    return {
      cardForm: {
        avatar: '',
        nickname: '',
        articleNum: '',
        viewCount: ''
      },
    }
  }, methods: {
    getUserCard() {
      let that = this
      mineInfo().then((data => {
        that.cardForm = data.data
      }))
    }
  }
}
</script>

<style scoped>
.userInfoCard {
  width: 200px;
  height: 250px;
}

.userHeader {
  width: 80px;
  height: 80px;
  border: 5px solid #ddd;
  border-radius: 50%;
  background-color: #5fb878;
}

.userName {
  font-weight: bold;
  text-align: center;
  font-size: 20px;
}
</style>
